package com.yunli.mall.common.schema;

import lombok.Data;

import java.io.Serializable;

/**
 * @author wangyue
 * @date 2020/7/20 12:06 PM
 */
@Data
public class ResponseInvokePage<T> implements Serializable {

    private Integer code;
    private String message;
    private ResponsePageData<T> result;

    private final static Integer OK = 0;
    private final static String OK_MSG = "SUCCESS";

    private ResponseInvokePage() {
        this.code = OK;
        this.message = OK_MSG;
    }

    private ResponseInvokePage(ResponsePageData<T> result) {
        this.code = OK;
        this.message = OK_MSG;
        this.result = result;
    }

    /**
     * @param result
     * @param <T>
     * @return
     */
    public static <T> ResponseInvokePage ok(ResponsePageData<T> result) {
        return new ResponseInvokePage<>(result);
    }
}
